import java.util.ArrayList;
import java.util.List;

public class TestMain {
    public static void main(String[] args) {
        luckcyredBag(100,1000,2);
    }

    //分是最小单位
    public static List<Double> luckcyredBag(int peopleNumber,double totalMoney,double minMoney){
        List<Double> redBaglist = new ArrayList<>(peopleNumber);
        setRedBagMoney(peopleNumber,totalMoney-(peopleNumber*minMoney),redBaglist,minMoney);
        System.out.println(redBaglist);
        return null;
    }
    //完全随机状态
    private static void setRedBagMoney(int lastPeople,double lastMoney,List<Double> redBaglist,double minMoney){
        if (lastPeople == 0){
            return;
        }
        int maxProbability = (int) (lastMoney * 100d);
        double redBagMoney = (Math.random() * maxProbability)/100d;
        redBaglist.add(redBagMoney+minMoney);
        setRedBagMoney(--lastPeople, (lastMoney -redBagMoney), redBaglist,minMoney);
    }

    //设置随机区间策略
    private static void setRedBagMoney2(int lastPeople,double lastMoney,List<Double> redBaglist,double minMoney){
        if (lastPeople == 0){
            return;
        }
        int maxProbability = (int) (lastMoney * 100d);
        double middleMoney = lastMoney/lastPeople;

        double redBagMoney = (Math.random() * maxProbability)/100d;
        redBaglist.add(redBagMoney+minMoney);
        setRedBagMoney(--lastPeople, (lastMoney -redBagMoney), redBaglist,minMoney);
    }
    private static void getProbilityArea(int lastPeople,double lastMoney){
        //设置概率区间精度 如 有 1000块 2-10
//        //下限
//        double min = 0.01;
//        //上限
//        double max = lastMoney - lastPeople*0.01;



    }
}
